package com.yanftch.hdc_tools.command

import com.intellij.openapi.actionSystem.AnActionEvent
import com.intellij.openapi.project.Project

interface Command {
    fun run(commandContext: CommandContext): Boolean
}

data class CommandContext(
    val project: Project,
    val bundleName: String,
    val defaultAbility: String,
    val hdcPath: String,
    val action: AnActionEvent
)


// 辅助APP的bundleName
const val assist_bundleName = "com.yanftch.hdc_tools"

// 查询已连接设备
const val hdc_list_targets = "list targets"

// 卸载指定bundleName的APP     {@link https://developer.huawei.com/consumer/cn/doc/harmonyos-guides-V5/hdc-V5#%E5%BA%94%E7%94%A8%E7%9B%B8%E5%85%B3%E5%91%BD%E4%BB%A4}
const val hdc_uninstall_app = "uninstall"
const val hdc_uninstall_app_with_hsp = "uninstall -s"

// 显示所有已安装的Bundle名称
const val hdc_shell_bm_dump__a = "shell bm dump -a"

const val start_and_copy = "shell aa start -a HDCEntryAbility -b com.yanftch.hdc_tools --ps paramStr"

// 强制停止应用进程   {@link https://developer.huawei.com/consumer/cn/doc/harmonyos-guides-V5/aa-tool-V5#force-stop}
const val force_stop = "shell aa force-stop"

// 清理缓存数据  {@link https://developer.huawei.com/consumer/cn/doc/harmonyos-guides-V5/bm-tool-V5#清理命令}
fun hdc_bm_clean_c(bundleName: String) = "shell bm clean -c -n $bundleName -u 100"
fun hdc_bm_clean_d(bundleName: String) = "shell bm clean -d -n $bundleName -u 100"


// 显示启动 Ability  {@link https://developer.huawei.com/consumer/cn/doc/harmonyos-guides-V5/aa-tool-V5#start}
fun hdc_aa_start(bundleName: String, defaultAbility: String) = "shell aa start -a $defaultAbility -b $bundleName"

// 以调试模式启动  {@link https://developer.huawei.com/consumer/cn/doc/harmonyos-guides-V5/aa-tool-V5#start}
fun hdc_aa_start_with_debugger(bundleName: String, defaultAbility: String) = "shell aa start -a $defaultAbility -b $bundleName -D"

